package cn.wind.xboot.core.utils;

import org.apache.commons.lang3.StringUtils;

import java.util.Random;

/**
 * <p>Title: MathUtil</p>
 * <p>Description: TODO</p>
 *
 * @author xukk
 * @version 1.0
 * @date 2018/8/17
 */
public class MathUtil {
    /**
     *
     *  产生随机的六位数
     *
     * @return String
     */
    public static String getSix(){
        Random rad=new Random();
        String result  = 100000+rad.nextInt(899999) +"";

        return result;
    }
    public static String getFour(){
        Random rad=new Random();
        String result  = 1000+rad.nextInt(8999) +"";

        return result;
    }

    /**
     *
     *  获得区间随机数
     * @param  min
     * @param  max
     * @return Integer
     */
    public static Integer getRandomNum(int min,int  max){
        int minValue = min;
        int maxValue = max;
        int result = minValue + (int)(Math.random() * ((maxValue - minValue) + 1));
        return result;
    }

    public static  boolean isDigitalLessThan(String[] arr){
        for (int i = 0; i <arr.length ; i++) {
            if(arr[i].trim().length()>3||!StringUtils.isNumeric(arr[i])){
                return false;
            }
        }
        return true;
    }
}